﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace SoundSynth
{
    public class Snippet
    {
        public Task TestSound()
        {
            return Task.Run(() =>
            {
                SynthVoice voice1 = new SynthVoice();
                SynthVoice voice2 = new SynthVoice();
                SynthVoice voice3 = new SynthVoice();

                SynthInstrument instrument = new SynthInstrument();
                instrument.Oscillators.Add(new Oscillators.SquareOscillator());
                instrument.Frequency = 440f; // frequence de base
                voice1.LoadInstrument(instrument);
                voice2.LoadInstrument(instrument);
                voice3.LoadInstrument(instrument);
                voice1.PlaySound(130f); //do
                voice2.PlaySound(164.81f);//mi
                voice2.PlaySound(196f);
                new ManualResetEvent(false).WaitOne(5000);
                voice1.StopNote();
                voice2.StopNote();
                voice3.StopNote();
            });
        }
    }
}
